<template>
  <el-dialog class="pick-dialog" title="更改状态" :visible.sync="dialogVisible" :close-on-click-modal="false" width="600px">
    <div class="form-box">
      <el-form :model="ruleForm" ref="ruleForm" label-width="auto" :rules="rules" class="demo-ruleForm">
        <el-form-item label="买家支付状态:" prop="salePay">
          <el-select v-model="ruleForm.salePay" >
            <el-option v-for="(item,key) in commonMaps.buyerPayState" :key="key" :label="item" :value="key"></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="卖家支付状态:" prop="supplyPay">
          <el-select v-model="ruleForm.supplyPay" >
            <el-option v-for="item in reasonListKefu" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item> -->
      </el-form>
      <div class="center">
        <el-button @click="close('ruleForm')">关闭</el-button>
        <el-button type="primary" @click="submitForm('ruleForm')" :loading="loading">确认</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import orderApi from '@/api/pickUp/order'
export default {
  name: "payEdit",
  data() {
    return {
      dialogVisible: false,
      loading: false,
      ruleForm: { 
        id:'',
        supplyPay:1,
        salePay:1

      },
      rules:
      {
      
      },
      from:'',//来源
    };
  },
  created() { },
  methods: {
    open(row,from) {
      this.from = from||''
      this.loading = false
      this.ruleForm.id = row.id;
      this.ruleForm.supplyPay = row.supplyPay
      this.ruleForm.salePay = String(row.salePay)
      this.dialogVisible = true;
    },
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.loading = true
          orderApi.editPayStatus(this.ruleForm).then(res=>{
            this.dialogVisible = false;
            this.loading = false
            if(res.code==200){
              this.$message.success(res.msg)
              this.$parent.getList()
            }
          })

        } else {
          //console.log("error submit!!");
          return false;
        }
      });
    },
    close(formName) {
      this.dialogVisible = false
    }
  }
};
</script>
<style scoped lang="scss">

.demo-ruleForm {
  padding-right: 20px;
}

.center {
  text-align: center;
}



.pick-dialog>>>.el-input--medium input {
  text-align: left;
}</style>
